package cn.fl.mcr.transform;

import java.util.ArrayList;
import java.util.List;

import cn.cmm.base.framework.utils.CollectionUtils;
import cn.fl.mcr.vo.McrCityChannelVO;
import cn.lionbridgecapital.loan.model.dto.McrCityChannelDTO;


/**
 * @Description: 城市放款通道 转换器
 * @Description: VO是客户端传递数据到服务端进行转换的数据 
 * @Description: VO转换数据变成DTO传递到服务端 
 * @Description: VO不能在服务端出现
 */
public class McrCityChannelVOTransform {


	/**
	 * DTO 转  VO
	 * @param po McrCityChannelDTO
	 * @return McrCityChannelVO
	 */
	public static McrCityChannelVO toVO(McrCityChannelDTO dto) {
		McrCityChannelVO  vo = null;
		if (dto != null) { 
			vo = new McrCityChannelVO();
			vo.setId(dto.getId());
			vo.setChannelCode(dto.getChannelCode());//放款通道ID
			vo.setCityCode(dto.getCityCode());//开放城市编码
			vo.setCityName(dto.getCityName());//开放城市名称
			vo.setIsDel(dto.getIsDel());//是否删除
			vo.setIsValid(dto.getIsValid());//是否有效

			vo.setCrtTm(dto.getCrtTm());//创建时间
			vo.setCrtUsrId(dto.getCrtUsrId());//创建人
			vo.setMdfTm(dto.getMdfTm());//修改时间
			vo.setMdfUsrId(dto.getMdfUsrId());//修改人
		}
		return vo;
	}

	/**
	 * VO 转 DTO
	 * @param dto McrCityChannelVO
	 * @return McrCityChannelDTO
	 */
	public static McrCityChannelDTO toDTO(McrCityChannelVO vo) {
		McrCityChannelDTO dto = null;
		if (vo != null) {
			dto = new McrCityChannelDTO();
			dto.setId(vo.getId());
			dto.setChannelCode(vo.getChannelCode());//放款通道ID
			dto.setCityCode(vo.getCityCode());//开放城市编码
			dto.setCityName(vo.getCityName());//开放城市名称
			dto.setIsDel(vo.getIsDel());//是否删除
			dto.setIsValid(vo.getIsValid());//是否有效

			dto.setCrtTm(vo.getCrtTm());//创建时间
			dto.setCrtUsrId(vo.getCrtUsrId());//创建人
			dto.setMdfTm(vo.getMdfTm());//修改时间
			dto.setMdfUsrId(vo.getMdfUsrId());//修改人
		}
		return dto;
	}
	
	/**
	 * DTO集合 转 VO集合
	 * @param List<McrCityChannelDTO>
	 * @return List<McrCityChannelVO>
	 */
	public static List<McrCityChannelVO> toVOList(List<McrCityChannelDTO> list) {
		List<McrCityChannelVO>  voList = new ArrayList<McrCityChannelVO>();
		if(CollectionUtils.isNotEmpty(list)){
			for (McrCityChannelDTO dto : list) {
				voList.add(toVO(dto));
			}
		}
		return voList;
	}
	
	/**
	 * VO集合 转 DTO集合
	 * @param list List<McrCityChannelVO>
	 * @return List<McrCityChannelDTO>
	 */
	public static List<McrCityChannelDTO> toDTOList(List<McrCityChannelVO> list) {
		List<McrCityChannelDTO>  dtoList = new ArrayList<McrCityChannelDTO>();
		if(CollectionUtils.isNotEmpty(list)){
			for (McrCityChannelVO vo : list) {
				dtoList.add(toDTO(vo));
			}
		}
		return dtoList;
	}
}
